import pymysql
import json

VERSION = 1003


def get_connect(host='localhost', user='pub', passwd='pub', db='stage'):
    return pymysql.connect(host, user, passwd, db, charset='utf8')


def _get_config(file='mysql.json'):
    with open(file, 'r') as config:
        return json.load(config)


def get_connect_from(file='mysql.json'):
    config = _get_config(file)
    db = pymysql.connect(config['host'], config['user'], config['passwd'], config['database'], charset='utf8')
    return db


if __name__ == '__main__':
    print('请不要直接执行本脚本')
